<?php

namespace app\common\server;

use think\Cache;

class Caches
{
    public static function getCache($name, $time, $call, $off = false)
    {
        if ($off || !Cache::has($name) || !$value = Cache::get($name)) {
            $value = call_user_func_array($call['class'], $call['param']);
            Cache::set($name, $value, $time);
        }
        return $value;
    }

    public static function clearCache($name)
    {
        Cache::rm($name);
    }
}